<template>
  <h1>hello vue3 + vite!</h1>
  <h2>count is: {{ count }}</h2>
  <h2>count.00 is: {{ count00 }}</h2>
  <button @click="add">count++</button>
  <hr>
  <Search @current-value="currentValue"/>
  <hr>
  <Counter msg="first" />
  <Counter msg="second counter"/>
  <Counter msg="---"/>
  <hr>
  <div>
    <router-link to="/">home</router-link>
    |
    <router-link to="/about">about</router-link>
  </div>
  <router-view />
</template>

<script setup>
import { ref, computed, watch } from "vue"
import Counter from "./components/Counter.vue"
import Search from "./components/Search.vue"

const count = ref(10)
const add = () => {
  count.value++
}

const count00 = computed(() => count.value.toFixed(2))
watch(count, (newVal, oldVal) => {
  console.log(newVal, oldVal)
})

const currentValue = (val) => {
  console.log(val)
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
</style>
